//封装所有与员工相关的接口

import instance from "@/utils/request.js";

//获取员工基本信息
export function getEmployeesApi(id) {
  return instance({
    url: `/sys/user/${id}`
  })
}
//保存员工基本信息
export function setEmployeesApi(data) {
  return instance({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}
//获取员工简单列表
export function getaddpartApi() {
  return instance({
    url: '/sys/user/simple'
  })
}


//获取员工列表
export function getEmployeesAllListApi(params) {
  return instance({
    url: '/sys/user',
    params
  })
}
//新增员工
export function addEmployeesApi(data) {
  return instance({
    url: '/sys/user',
    method: 'POST',
    data
  })
}
//批量导入员工
export function importEmployeesApi(data) {
  return instance({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}
//获取员工个人信息
export function getDetailInfoApi(id) {
  return instance({
    url: `/employees/${id}/personalInfo`

  })
}
//获取员工岗位信息
export function getJobInfoApi(id) {
  return instance({
    url: `/employees/${id}/jobs`

  })
}

//分配员工的角色
export function setEmployeesRoleApi(data) {
  return instance({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}
